<template>
  <div class="paihang">
    <div id="continue">
      <h2 id="going">正在进行的活动</h2>
      <div class="imgPic">
        <router-link to="/activity/10017" exact>
          <img src="../../assets/bgoing.jpg" alt />
        </router-link>
      </div>
      <h2 id="list">上期排行榜</h2>
      <div id="pailist">
        <div class="kuang" v-for="(paihang,index) in paihangs" v-show="index<5" :key="index">
          <el-row>
            <el-col :span="12">
              <div class="grid-content bg-purple">
                <div class="charts">
                  <span>No.{{index+1}}</span>
                  <ul>
                    <router-link
                      tag="li"
                      :to="{ name: 'Note', params: { id: paihang.noteId } }"
                    >{{paihang.noteTitle}}</router-link>
                    <router-link
                      tag="li"
                      :to="{ name: 'Note', params: { id: paihang.noteId } }"
                    >{{paihang.userName}}</router-link>
                    <router-link
                      tag="li"
                      :to="{ name: 'Note', params: { id: paihang.noteId } }"
                    >收藏数：{{paihang.collectNum}}</router-link>
                  </ul>
                </div>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="grid-content bg-purple-light">
                <div class="gameTitleId">{{paihang.gameTitleId}}</div>
                <div class="chartsPic">
                  <router-link :to="{ name: 'Note', params: { id: paihang.noteId } }">
                    <img :src="'/api/upload/' + paihang.noteImg1" alt />
                  </router-link>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
        <hr />
      </div>
    </div>
  </div>
</template>
<style lang="css" scoped>
.el-row {
  margin-bottom: 20px;
}
.el-row:last-child {
  margin-bottom: 0;
}
.el-col {
  border-radius: 4px;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
h2 {
  font-size: 20px;
  color: #e6a23c;
  font-weight: 700;
  line-height: 48px;
  margin-left: 20px;
  margin-top: 20px;
}
.imgPic {
  /* width: 81%; */
  overflow: hidden;
  /* margin-bottom: 20px;
  margin-top: 10px;
  margin-left: 20px; */
}
.imgPic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  cursor: pointer;
  transition: all 0.5s;
}
.imgPic img:hover {
  transform: scale(1.1);
}
#pailist {
  display: inline-block;
  text-align: center;
}
.kuang {
  display: inline-block;
  border: 1px solid #e6a23c;
  margin-bottom: 10px;
  width: 90%;
}
.charts {
  font-style: normal;
  height: 150px;
  padding-left: 5px;
  text-align: left;
}
.charts span {
  display: inline-block;
  width: 54%;
  height: 40px;
  background-color: #e6a23c;
  color: white;
  font-size: 18px;
  line-height: 40px;
  text-align: center;
}
.charts ul {
  list-style: none;
  margin-top: 10px;
}
.charts ul li {
  font-size: 17px;
  line-height: 1.8em;
  width: 95%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.charts ul li:nth-child(2) {
  font-size: 16px;
}
.charts ul li:nth-child(3) {
  color: #ccc;
  font-size: 16px;
}
.gameTitleId {
  display: none;
}
.chartsPic {
  height: 150px;
  overflow: hidden;
  display: inline-block;
}
.chartsPic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  cursor: pointer;
  transition: all 0.5s;
}
.chartsPic img:hover {
  transform: scale(1.1);
}
</style>
<script>
export default {
  data() {
    return {
      queryId: -1,
      paihangs: []
    };
  },

  created() {
    // this.queryId = this.$route.params.id;
    this.$axios
      .get("/api/gameTitle/getPaihang", {
        params: { gameTitleId: this.queryId }
      })
      .then(res => {
        // console.log("paihangs:", res);
        this.paihangs = res.data.data;
      })
      .catch(err => {
        console.log("err:", err);
      });
  }
};
</script>